package com.wondersgroup.fjzlpt.console.constant;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public enum RoleScope {
	PLAT("平台", "1")
	,ORG("机构", "2");
	
	private String name;

	public String getValue() {
		return value;
	}

	private String value;
	
	private RoleScope(String name, String value)
	{
		this.name = name;
		this.value = value;
	}
	
	public static JSONObject getAllJsonObject()
	{
		JSONObject json = new JSONObject();
		RoleScope[] ary = RoleScope.class.getEnumConstants();
		for(RoleScope rs: ary)
		{
			json.put(rs.value, rs.name);
		}
		return json;
	}
	
	public static JSONArray getAll()
	{
		JSONArray jsonAry = new JSONArray();
		RoleScope[] ary = RoleScope.class.getEnumConstants();
		for(RoleScope rs: ary)
		{
			JSONObject json = new JSONObject(2);
			json.put("XMDM", rs.value);
			json.put("XMMC", rs.name);
			jsonAry.add(json);
		}
		return jsonAry;
	}
}
